(function (factory) {
    if (typeof module === "object" && typeof module.exports === "object") {
        var v = factory(require, exports);
        if (v !== undefined) module.exports = v;
    }
    else if (typeof define === "function" && define.amd) {
        define(["require", "exports"], factory);
    }
})(function (require, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    const { exec } = require('child_process');
    async function getWlanInfo() {
        const command = 'chcp 65001 && netsh wlan show interfaces';
        return new Promise((resolve, reject) => {
            exec(command, (error, stdout, stderr) => {
                if (error) {
                    console.error(`错误: ${error.message}`);
                    return null;
                }
                if (stderr) {
                    console.error(`stderr: ${stderr}`);
                    return null;
                }
                const Dictionaries = {
                    "Name": "名称",
                    "Description": "说明",
                    "GUID": "GUID",
                    "Physical address": "物理地址",
                    "Interface type": "界面类型",
                    "State": "状态",
                    "SSID": "SSID",
                    "BSSID": "BSSID",
                    "Network type": "网络类型",
                    "Radio type": "无线电类型",
                    "Radio Authentication": "身份验证",
                    "Cipher": "密码",
                    "Connection mode": "连接模式",
                    "Band": "频带",
                    "Channel": "通道",
                    "Receive rate (Mbps)": "接收速率(Mbps)",
                    "Transmit rate (Mbps)": "传输速率 (Mbps)",
                    "Signal": "信号",
                    "Profile": "配置文件",
                };
                stdout = stdout.split('\n').slice(4).join('\n');
                stdout = stdout.split('\n').slice(0, -4).join('\n');
                const wlanInfo = stdout.split('\n').map(line => {
                    const row = line.trim().split(':');
                    const key = row?.shift()?.trim();
                    const value = row.join(':').trim();
                    return {
                        key,
                        value,
                        translate: Dictionaries[key] || key
                    };
                });
                resolve(wlanInfo);
            });
        });
    }
    exports.default = getWlanInfo;
});
